/*
 * Decompiled with CFR 0.150.
 * 
 * Could not load the following classes:
 *  cn.hutool.core.util.ObjectUtil
 *  com.alibaba.fastjson.JSON
 *  de.felixroske.jfxsupport.FXMLController
 *  javafx.collections.FXCollections
 *  javafx.collections.ObservableList
 *  javafx.fxml.FXML
 *  javafx.fxml.Initializable
 *  javafx.scene.control.Alert
 *  javafx.scene.control.Alert$AlertType
 *  javafx.scene.control.ComboBox
 *  javafx.scene.control.ScrollPane
 *  javafx.scene.control.TextArea
 *  javafx.scene.layout.Pane
 *  org.springframework.beans.factory.annotation.Autowired
 */
package com.gys.controller.baseSetting.saleSchedule;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.gys.common.business.SaleBillSetUtil;
import com.gys.common.data.HttpJson;
import com.gys.common.data.KeyValue;
import com.gys.common.util.CommonUtil;
import com.gys.common.util.PrintService;
import com.gys.controller.BaseController;
import com.gys.controller.dataManger.ControllerManger;
import com.gys.data.saleBillSet.GaiaSdPrintSale;
import de.felixroske.jfxsupport.FXMLController;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Pane;
import org.springframework.beans.factory.annotation.Autowired;

@FXMLController
public class SaleBillSettingController
extends BaseController
implements Initializable {
    @FXML
    private TextArea mode1;
    @FXML
    private TextArea mode6;
    @FXML
    private TextArea mode5;
    @FXML
    private TextArea model6Text;
    @FXML
    private TextArea model5Text;
    @FXML
    private TextArea model1Text;
    @FXML
    private TextArea model2Text;
    @FXML
    private TextArea model3Text;
    @FXML
    private TextArea model4Text;
    @FXML
    private ScrollPane scrollPane;
    @FXML
    private Pane pane;
    @FXML
    private ComboBox<KeyValue> planSelect;
    @Autowired
    private PrintService printService;

    public void initialize(URL location, ResourceBundle resources) {
        ControllerManger.controllerMap.put(this.getClass().getSimpleName(), this);
        this.scrollPane.setPrefWidth(this.getContentWidth());
        this.scrollPane.setPrefHeight(this.getContentHeight());
        this.init();
    }

    @Override
    public void init() {
        if (ObjectUtil.isEmpty(this.model4Text)) {
            return;
        }
        this.planSelect.setValue(new KeyValue());
        ObservableList options = FXCollections.observableArrayList(new ArrayList());
        options.add(new KeyValue("\u65b9\u6848\u4e00", "01"));
        options.add(new KeyValue("\u65b9\u6848\u4e8c", "02"));
        options.add(new KeyValue("\u65b9\u6848\u4e09", "03"));
        this.planSelect.setItems(options);
        CommonUtil.comboxInit(this.planSelect);
        this.mode1.setDisable(true);
        this.mode5.setDisable(true);
        this.mode6.setDisable(true);
        this.mode1.clear();
        this.mode5.clear();
        this.mode6.clear();
        this.model1Text.clear();
        this.model5Text.clear();
        this.model6Text.clear();
        HttpJson httpJson = SaleBillSetUtil.get();
        GaiaSdPrintSale outData = null;
        if (httpJson.isSuccess()) {
            outData = (GaiaSdPrintSale)JSON.parseObject((String)httpJson.getMsg(), GaiaSdPrintSale.class);
            if (ObjectUtil.isNotEmpty(outData)) {
                if ("01".equals(outData.getGspsLoadProject())) {
                    this.planSelect.setValue(new KeyValue("\u65b9\u6848\u4e00", "01"));
                } else if ("02".equals(outData.getGspsLoadProject())) {
                    this.planSelect.setValue(new KeyValue("\u65b9\u6848\u4e8c", "02"));
                } else if ("03".equals(outData.getGspsLoadProject())) {
                    this.planSelect.setValue(new KeyValue("\u65b9\u6848\u4e09", "03"));
                }
                this.model1Text.setText(outData.getGspsModule1());
                this.model5Text.setText(outData.getGspsModule5());
                this.model6Text.setText(outData.getGspsModule6());
            }
        } else {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
            alert.showAndWait();
            return;
        }
    }

    @FXML
    private void mode1Action() {
        this.mode1.setDisable(false);
    }

    @FXML
    private void mode5Action() {
        this.mode5.setDisable(false);
    }

    @FXML
    private void mode6Action() {
        this.mode6.setDisable(false);
    }

    @FXML
    private void printTestAction() {
        this.printService.printTest();
    }

    @FXML
    private void preViewAction() {
        if (!this.mode1.isDisabled()) {
            this.model1Text.setText(this.mode1.getText());
        }
        if (!this.mode5.isDisabled()) {
            this.model5Text.setText(this.mode5.getText());
        }
        if (!this.mode6.isDisabled()) {
            this.model6Text.setText(this.mode6.getText());
        }
    }

    @FXML
    private void saveAction() {
        HttpJson httpJson;
        if (!this.check()) {
            return;
        }
        HashMap<String, Object> param = new HashMap<String, Object>();
        param.put("gspsLoadProject", ((KeyValue)this.planSelect.getValue()).getValue());
        if (ObjectUtil.isNotEmpty(this.mode1.getText())) {
            param.put("gspsModule1", this.mode1.getText());
        }
        if (ObjectUtil.isNotEmpty(this.mode5.getText())) {
            param.put("gspsModule5", this.mode5.getText());
        }
        if (ObjectUtil.isNotEmpty(this.mode6.getText())) {
            param.put("gspsModule6", this.mode6.getText());
        }
        if ((httpJson = SaleBillSetUtil.save(param)).isSuccess()) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u4fdd\u5b58\u6210\u529f");
            alert.showAndWait();
            return;
        }
        Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", httpJson.getMsg());
        alert.showAndWait();
    }

    private boolean check() {
        if (ObjectUtil.isEmpty(((KeyValue)this.planSelect.getValue()).getValue())) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u8bf7\u9009\u62e9\u9884\u8bbe\u5c0f\u7968\u65b9\u6848");
            alert.showAndWait();
            return false;
        }
        if (this.mode1.getText().length() > 1000) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u6a21\u57571\u8f93\u5165\u5185\u5bb9\u6700\u59271000");
            alert.showAndWait();
            return false;
        }
        if (this.mode5.getText().length() > 1000) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u6a21\u57575\u8f93\u5165\u5185\u5bb9\u6700\u59271000");
            alert.showAndWait();
            return false;
        }
        if (this.mode6.getText().length() > 1000) {
            Alert alert = this.createAlert(Alert.AlertType.INFORMATION, "\u63d0\u793a\u4fe1\u606f", "\u6a21\u57576\u8f93\u5165\u5185\u5bb9\u6700\u59271000");
            alert.showAndWait();
            return false;
        }
        return true;
    }

    public TextArea getMode1() {
        return this.mode1;
    }

    public TextArea getMode6() {
        return this.mode6;
    }

    public TextArea getMode5() {
        return this.mode5;
    }

    public TextArea getModel6Text() {
        return this.model6Text;
    }

    public TextArea getModel5Text() {
        return this.model5Text;
    }

    public TextArea getModel1Text() {
        return this.model1Text;
    }

    public TextArea getModel2Text() {
        return this.model2Text;
    }

    public TextArea getModel3Text() {
        return this.model3Text;
    }

    public TextArea getModel4Text() {
        return this.model4Text;
    }

    public ScrollPane getScrollPane() {
        return this.scrollPane;
    }

    public Pane getPane() {
        return this.pane;
    }

    public ComboBox<KeyValue> getPlanSelect() {
        return this.planSelect;
    }

    public PrintService getPrintService() {
        return this.printService;
    }

    public void setMode1(TextArea mode1) {
        this.mode1 = mode1;
    }

    public void setMode6(TextArea mode6) {
        this.mode6 = mode6;
    }

    public void setMode5(TextArea mode5) {
        this.mode5 = mode5;
    }

    public void setModel6Text(TextArea model6Text) {
        this.model6Text = model6Text;
    }

    public void setModel5Text(TextArea model5Text) {
        this.model5Text = model5Text;
    }

    public void setModel1Text(TextArea model1Text) {
        this.model1Text = model1Text;
    }

    public void setModel2Text(TextArea model2Text) {
        this.model2Text = model2Text;
    }

    public void setModel3Text(TextArea model3Text) {
        this.model3Text = model3Text;
    }

    public void setModel4Text(TextArea model4Text) {
        this.model4Text = model4Text;
    }

    public void setScrollPane(ScrollPane scrollPane) {
        this.scrollPane = scrollPane;
    }

    public void setPane(Pane pane) {
        this.pane = pane;
    }

    public void setPlanSelect(ComboBox<KeyValue> planSelect) {
        this.planSelect = planSelect;
    }

    public void setPrintService(PrintService printService) {
        this.printService = printService;
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof SaleBillSettingController)) {
            return false;
        }
        SaleBillSettingController other = (SaleBillSettingController)o;
        if (!other.canEqual(this)) {
            return false;
        }
        TextArea this$mode1 = this.getMode1();
        TextArea other$mode1 = other.getMode1();
        if (this$mode1 == null ? other$mode1 != null : !this$mode1.equals(other$mode1)) {
            return false;
        }
        TextArea this$mode6 = this.getMode6();
        TextArea other$mode6 = other.getMode6();
        if (this$mode6 == null ? other$mode6 != null : !this$mode6.equals(other$mode6)) {
            return false;
        }
        TextArea this$mode5 = this.getMode5();
        TextArea other$mode5 = other.getMode5();
        if (this$mode5 == null ? other$mode5 != null : !this$mode5.equals(other$mode5)) {
            return false;
        }
        TextArea this$model6Text = this.getModel6Text();
        TextArea other$model6Text = other.getModel6Text();
        if (this$model6Text == null ? other$model6Text != null : !this$model6Text.equals(other$model6Text)) {
            return false;
        }
        TextArea this$model5Text = this.getModel5Text();
        TextArea other$model5Text = other.getModel5Text();
        if (this$model5Text == null ? other$model5Text != null : !this$model5Text.equals(other$model5Text)) {
            return false;
        }
        TextArea this$model1Text = this.getModel1Text();
        TextArea other$model1Text = other.getModel1Text();
        if (this$model1Text == null ? other$model1Text != null : !this$model1Text.equals(other$model1Text)) {
            return false;
        }
        TextArea this$model2Text = this.getModel2Text();
        TextArea other$model2Text = other.getModel2Text();
        if (this$model2Text == null ? other$model2Text != null : !this$model2Text.equals(other$model2Text)) {
            return false;
        }
        TextArea this$model3Text = this.getModel3Text();
        TextArea other$model3Text = other.getModel3Text();
        if (this$model3Text == null ? other$model3Text != null : !this$model3Text.equals(other$model3Text)) {
            return false;
        }
        TextArea this$model4Text = this.getModel4Text();
        TextArea other$model4Text = other.getModel4Text();
        if (this$model4Text == null ? other$model4Text != null : !this$model4Text.equals(other$model4Text)) {
            return false;
        }
        ScrollPane this$scrollPane = this.getScrollPane();
        ScrollPane other$scrollPane = other.getScrollPane();
        if (this$scrollPane == null ? other$scrollPane != null : !this$scrollPane.equals(other$scrollPane)) {
            return false;
        }
        Pane this$pane = this.getPane();
        Pane other$pane = other.getPane();
        if (this$pane == null ? other$pane != null : !this$pane.equals(other$pane)) {
            return false;
        }
        ComboBox<KeyValue> this$planSelect = this.getPlanSelect();
        ComboBox<KeyValue> other$planSelect = other.getPlanSelect();
        if (this$planSelect == null ? other$planSelect != null : !this$planSelect.equals(other$planSelect)) {
            return false;
        }
        PrintService this$printService = this.getPrintService();
        PrintService other$printService = other.getPrintService();
        return !(this$printService == null ? other$printService != null : !(this$printService).equals(other$printService));
    }

    protected boolean canEqual(Object other) {
        return other instanceof SaleBillSettingController;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        TextArea $mode1 = this.getMode1();
        result = result * 59 + ($mode1 == null ? 43 : $mode1.hashCode());
        TextArea $mode6 = this.getMode6();
        result = result * 59 + ($mode6 == null ? 43 : $mode6.hashCode());
        TextArea $mode5 = this.getMode5();
        result = result * 59 + ($mode5 == null ? 43 : $mode5.hashCode());
        TextArea $model6Text = this.getModel6Text();
        result = result * 59 + ($model6Text == null ? 43 : $model6Text.hashCode());
        TextArea $model5Text = this.getModel5Text();
        result = result * 59 + ($model5Text == null ? 43 : $model5Text.hashCode());
        TextArea $model1Text = this.getModel1Text();
        result = result * 59 + ($model1Text == null ? 43 : $model1Text.hashCode());
        TextArea $model2Text = this.getModel2Text();
        result = result * 59 + ($model2Text == null ? 43 : $model2Text.hashCode());
        TextArea $model3Text = this.getModel3Text();
        result = result * 59 + ($model3Text == null ? 43 : $model3Text.hashCode());
        TextArea $model4Text = this.getModel4Text();
        result = result * 59 + ($model4Text == null ? 43 : $model4Text.hashCode());
        ScrollPane $scrollPane = this.getScrollPane();
        result = result * 59 + ($scrollPane == null ? 43 : $scrollPane.hashCode());
        Pane $pane = this.getPane();
        result = result * 59 + ($pane == null ? 43 : $pane.hashCode());
        ComboBox<KeyValue> $planSelect = this.getPlanSelect();
        result = result * 59 + ($planSelect == null ? 43 : $planSelect.hashCode());
        PrintService $printService = this.getPrintService();
        result = result * 59 + ($printService == null ? 43 : ($printService).hashCode());
        return result;
    }

    public String toString() {
        return "SaleBillSettingController(mode1=" + this.getMode1() + ", mode6=" + this.getMode6() + ", mode5=" + this.getMode5() + ", model6Text=" + this.getModel6Text() + ", model5Text=" + this.getModel5Text() + ", model1Text=" + this.getModel1Text() + ", model2Text=" + this.getModel2Text() + ", model3Text=" + this.getModel3Text() + ", model4Text=" + this.getModel4Text() + ", scrollPane=" + this.getScrollPane() + ", pane=" + this.getPane() + ", planSelect=" + this.getPlanSelect() + ", printService=" + this.getPrintService() + ")";
    }
}

